package com.yjhb.android.sbz.dialog;

import android.app.Activity;
import android.view.Gravity;
import android.view.View;
import android.view.WindowManager;
import android.widget.TextView;

import com.yjhb.android.sbz.R;
import com.jojo.android.zxlib.base.BaseDialog;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * 创建者 zx
 * 创建时间 2021/2/4 16:47
 */
public class SelectedDialog extends BaseDialog {
    private final String TAG = "SelectedDialog";
    @BindView(R.id.scan)
    TextView scan;
    @BindView(R.id.save)
    TextView save;
    @BindView(R.id.cancel)
    TextView cancel;

    public SelectedDialog(Activity context) {
        super(context);
    }

    @Override
    protected void init() {
        setCancelable(true);
        setCanceledOnTouchOutside(true);
        //显示在底部
        getWindow().setGravity(Gravity.BOTTOM);
        WindowManager.LayoutParams lp = getWindow().getAttributes();
        //宽度撑满
        lp.width = -1; //设置宽度
        getWindow().setAttributes(lp);
    }

    @Override
    protected int getLayoutId() {
        return R.layout.dialog_selected;
    }

    @OnClick({R.id.scan, R.id.save, R.id.cancel})
    void onClick(View view) {
        if (view == scan) {
            if (onClickListener != null) {
                onClickListener.onClick(this, 1);
            }
        }
        if (view == save) {
            if (onClickListener != null) {
                onClickListener.onClick(this, 2);
            }
        }
        if (view == cancel) {
            if (onClickListener != null) {
                onClickListener.onClick(this, 3);
            }
        }
    }

}
